package com.oct.ywsc.core;

import com.alibaba.fastjson2.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class JsonUtil {


    public static Map<String,String> toMap(JSONObject json){
        Map<String,String> map = new HashMap<String,String>();
        for (Map.Entry<String,Object> entry : json.entrySet()){
            if (entry.getValue() instanceof JSONObject){
               Map<String,String> map1 = toMap( (JSONObject) entry.getValue());
               map.putAll(map1);
            }else{
                map.put(entry.getKey(),entry.getValue().toString());
            }
        }

        return map;
    }

}
